using System;
using System.IO;

namespace Atomic.Libraries
{
	public static class FileInfoExtensions
	{
		public static FileInfo AddFile(this DirectoryInfo directory, string name)
		{
			return new FileInfo(Path.Combine(directory.FullName, name));
		}

		public static FileInfo AddFileExtension(this FileInfo file, string extension)
		{
			return new FileInfo(file.FullName + extension);
		}

		public static DirectoryInfo AddDirectory(this DirectoryInfo directory, string name)
		{
			return new DirectoryInfo(Path.Combine(directory.FullName, name));
		}

		public static DirectoryInfo AddDirectory(this DirectoryInfo directory, params string[] names)
		{
			foreach (string name in names)
			{
				directory = directory.AddDirectory(name);
			}
			return directory;
		}
	}
}
